home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / elk-2_0.lha / elk-2.0 / lib / xt / translation.c < prev    next >
C/C++ Source or Header  |  1991-09-16  |  2KB  |  58 lines

  1. #include "xt.h"
  2.  
  3. XtTranslations Get_Translations (t) Object t; {
  4.     register char *s;
  5.     XtTranslations ret;
  6.     Declare_C_Strings;
  7.  
  8.     Make_C_String (t, s);
  9.     if ((ret = XtParseTranslationTable (s)) == 0)
  10.     Primitive_Error ("bad translation table: ~s", t);
  11.     Dispose_C_Strings;
  12.     return ret;
  13. }
  14.  
  15. static Object P_Augment_Translations (w, t) Object w, t; {
  16.     Check_Widget (w);
  17.     XtAugmentTranslations (WIDGET(w)->widget, Get_Translations (t));
  18.     return Void;
  19. }
  20.     
  21. static Object P_Override_Translations (w, t) Object w, t; {
  22.     Check_Widget (w);
  23.     XtOverrideTranslations (WIDGET(w)->widget, Get_Translations (t));
  24.     return Void;
  25. }
  26.  
  27. static Object P_Uninstall_Translations (w) Object w; {
  28.     Check_Widget (w);
  29.     XtUninstallTranslations (WIDGET(w)->widget);
  30.     return Void;
  31. }
  32.  
  33. /* Due to a bug in Xt these functions drop core when invoked with a
  34.  * display not owned by Xt.
  35.  */
  36. static Object P_Multi_Click_Time (d) Object d; {
  37.     Check_Type (d, T_Display);
  38.     return Make_Integer (XtGetMultiClickTime (DISPLAY(d)->dpy));
  39. }
  40.  
  41. static Object P_Set_Multi_Click_Time (d, t) Object d, t; {
  42.     Check_Type (d, T_Display);
  43.     XtSetMultiClickTime (DISPLAY(d)->dpy, Get_Integer (t));
  44.     return Void;
  45. }
  46.  
  47. init_xt_translation () {
  48.     Define_Primitive (P_Augment_Translations,
  49.             "augment-translations",                  2, 2, EVAL);
  50.     Define_Primitive (P_Override_Translations, 
  51.             "override-translations",                 2, 2, EVAL);
  52.     Define_Primitive (P_Uninstall_Translations,
  53.             "uninstall-translations",                1, 1, EVAL);
  54.     Define_Primitive (P_Multi_Click_Time,   "multi-click-time",  1, 1, EVAL);
  55.     Define_Primitive (P_Set_Multi_Click_Time,
  56.             "set-multi-click-time!",                 2, 2, EVAL);
  57. }
  58.